#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
#include <QProgressBar>


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //防止勾选了创建UI文件重新新建对象导致内存泄漏
    this->setStatusBar(this->statusBar());
    //显示一个临时信息
    //this->statusBar()->showMessage("这是一个状态信息",3000);//存在3000ms

    //给状态栏创建一个子控件
    QLabel* label=new QLabel("状态栏子控件");
    this->statusBar()->addWidget(label);
    QProgressBar* progressBar=new QProgressBar();
    progressBar->setRange(0,100);
    progressBar->setValue(50);
    this->statusBar()->addWidget(progressBar);
}

MainWindow::~MainWindow()
{
    delete ui;
}

